package com.jd.rapid.rpc.provider.test;

import com.jd.rapid.rpc.config.provider.ProviderConfig;
import com.jd.rapid.rpc.config.provider.RpcServerConfig;

import java.util.ArrayList;
import java.util.List;

public class ProviderStarter {


    public static void main(String[] args) {
        //硬编码

        //服务端启动
        new Thread(new Runnable() {
            @Override
            public void run() {
                //每一个具体的服务提供者配置类
                ProviderConfig providerConfig=new ProviderConfig();
                providerConfig.setInterface("com.jd.rapid.rpc.consumer.test.HelloService");
                HelloServiceImpl helloServiceImpl=new HelloServiceImpl();
                providerConfig.setRef(helloServiceImpl);

                //把所以的ProviderConfig添加到集合中
                List<ProviderConfig> providerConfigs=new ArrayList<>();
                providerConfigs.add(providerConfig);


                RpcServerConfig rpcServerConfig=new RpcServerConfig(providerConfigs);
                rpcServerConfig.setPort(8769);
                rpcServerConfig.exporter();
            }
        }).start();
        System.out.println("w");
    }
}
